//go:build !oracle
// +build !oracle

package main

import (
	_ "github.com/go-sql-driver/mysql"

	"gitee.com/micro-plat/sas/sas"
	"github.com/micro-plat/hydra"
	"github.com/micro-plat/hydra/conf/app"
	"github.com/micro-plat/hydra/conf/vars/db"
)

//bindConf 绑定启动配置， 启动时检查注册中心配置是否存在，不存在则引导用户输入配置参数并自动创建到注册中心
func install() {

	//根据配置初始化服务
	hydra.S.OnSetup(func(conf app.IAPPConf) error {
		proc, err := conf.GetProcessorConf()
		if err != nil {
			return err
		}

		//绑定SSO服务
		return sas.Bind(hydra.S.API, sas.WithServicePrefix(proc.ServicePrefix))
	})

	hydra.OnReady(func() error {
		hydra.Conf.Vars().RPC("rpc")
		hydra.Conf.Vars().HTTP("http")
		hydra.Conf.Vars().DB().MySQL("db", "hbsv21_dev", "123456dev", "192.168.0.36:3306", "hbsv21_dev", db.WithConnect(20, 10, 600))
		hydra.Conf.API("8363")
		return nil
	})
}
